未完待续:关于DB Link和SCN,你还需要知道的是... 您所在的位置:网站首页 数据库 scn 未完待续:关于DB Link和SCN,你还需要知道的是...

未完待续:关于DB Link和SCN,你还需要知道的是...

2023-03-20 05:14| 来源: 网络整理| 查看: 265

通过隐含参数列表,可以获得 big scn 的一个隐含参数,从这个注释中可以看出新特性被命名为 BigSCN, 缺省值是 2 ,在产品环境中这个参数不可以修改,是以测试目的设置的 :

NAME: _big_scn_test_mode

VALUE: 2

DESCRIB: testing mode for BigSCN

NAME: _big_scn_test_mode

VALUE: 2

DESCRIB: testing mode for BigSCN

通过以上两类输出,可以看到,当 _big_scn_test_mode 被设置为 4 的时候,SCN 会增进为 0x0002000000000000 ,由这些我们可以看出 SCN 终于突破了 6 Bytes 的设置,进入到了 8 Bytes 时代。

插播活动信息:

2018 ACOUG中国行之·上海站 4月13日上海相见,从Oracle 18c到MySQL 8.0 ,5 大技术主题,欢迎来约,报名详情参考:

ACOUG China Tour 2018 - 4月13日启航上海站

当SCN mode 设置为 4 的时候,SCN 会直接跃迁到 7 Bytes,超越了 6 Bytes 的界限。

那么这个SCN 是多少?

SQL> select to_number('2000000000000','xxxxxxxxxxxxx') scn

from dual;

SCN

------------------------

562,949,953,421,312

SQL> select to_number('2000000000000','xxxxxxxxxxxxx') scn

from dual;

SCN

------------------------

562,949,953,421,312

而 6 Bytes 的 SCN极限值是281 trillion :

SQL> select power(2,48) scn from dual;

SCN

------------------------

281,474,976,710,656

SQL> select power(2,48) scn from dual;

SCN

------------------------

281,474,976,710,656

将这两组数据放到一个表格会显得一目了然:

SCN 位数和设置 SCN值 6 Bytes最大可用 281,474,976,710,656 _big_scn_test_mode=4 562,949,953,421,312 BigSCN 最大可用 9,223,372,036,854,775,808

_big_scn_test_mode=4 的起点是 49 位,比较 原来的 48 位增进一位,这个起点就直接超越了过去的最大限制:

SQL> select power(2,49) scn from dual;

SCN

------------------------

562,949,953,421,312

SQL> select power(2,49) scn from dual;

SCN

------------------------

562,949,953,421,312

BigSCN 最大可用值上升到一个天量数字,可以看到关于SCN问题,我们越来越不需要去担心了:

SQL> select power(2,63) scn from dual;

SCN

--------------------------------

9,223,372,036,854,775,808

SQL> select power(2,63) scn from dual;

SCN

--------------------------------

9,223,372,036,854,775,808

虽然理论值做出了改变,SCN的地址空间也获得了增加,但是在实践中,这些新特性的获得是渐进式,在 12.2 之后,这些特性才会逐渐的释放出来。

在以下我的测试环境中,尝试将SCN推进到了极高的位置:

SQL> select current_scn scn from v$database;

SCN

--------------------------------

4,519,057,215,000,399

SQL> oradebug setmypid

Statement processed.

SQL> oradebug dumpvar sga kcsgscn_

kcslf kcsgscn_ [0600113B8, 0600113E8) = 00050F5D 00100E0F

SQL> select current_scn scn from v$database;

SCN

--------------------------------

4,519,057,215,000,399

SQL> oradebug setmypid

Statement processed.

SQL> oradebug dumpvar sga kcsgscn_

kcslf kcsgscn_ [0600113B8, 0600113E8) = 00050F5D 00100E0F

将这个数字放到前面的表格中,大家可以看到SCN在实践中可以获得的海量值空间:

SCN 位数和设置 SCN值 6 位SmallSCN最大 281,474,976,710,656 _big_scn_test_mode=4 562,949,953,421,312 测试环境 SCN 推进量 4,519,057,215,000,399 8 位BigSCN最大 9,223,372,036,854,775,808

为了防止SCN的过度增加,Oracle 增加了内部函数去分析headroom,并通过 600 号错误的 kcm_low_scn_headroom_alert_1 抛出异常:

2018-03-23T18:12:01.849206+08:00

Errors in file /enmo12c/enmo12c/trace/enmo12c_ora_5259.trc (incident=174424) (PDBNAME=CDB$ROOT):

ORA-00600: internal error code, arguments: [2252], [4520092301887888], [4519517455400960], [], [], [], [], [], [], [], [], []

Incident details in: /enmo12c/enmo12c/incident/incdir_174424/enmo12c_ora_5259_i174424.trc

2018-03-23T18:12:01.858629+08:00

Errors in file /enmo12c/enmo12c/trace/enmo12c_ckpt_5220.trc (incident=174304) (PDBNAME=CDB$ROOT):

ORA-00600: internal error code, arguments: [kcm_low_scn_headroom_alert_1], [], [], [], [], [], [], [], [], [], [], []

Incident details in: /enmo12c/enmo12c/incident/incdir_174304/enmo12c_ckpt_5220_i174304.trc

2018-03-23T18:12:01.849206+08:00

Errors in file /enmo12c/enmo12c/trace/enmo12c_ora_5259.trc (incident=174424) (PDBNAME=CDB$ROOT):

ORA-00600: internal error code, arguments: [2252], [4520092301887888], [4519517455400960], [], [], [], [], [], [], [], [], []

Incident details in: /enmo12c/enmo12c/incident/incdir_174424/enmo12c_ora_5259_i174424.trc

2018-03-23T18:12:01.858629+08:00

Errors in file /enmo12c/enmo12c/trace/enmo12c_ckpt_5220.trc (incident=174304) (PDBNAME=CDB$ROOT):

ORA-00600: internal error code, arguments: [kcm_low_scn_headroom_alert_1], [], [], [], [], [], [], [], [], [], [], []

Incident details in: /enmo12c/enmo12c/incident/incdir_174304/enmo12c_ckpt_5220_i174304.trc

这个启用了 BigSCN 的 12.2 数据库,当通过DB Link连接 11.2.0.4 的数据库时:

SQL> create database link enmo

connect to eygle identified by eygle using 'enmo';

Database link created.

SQL> select * from dual@enmo;

select * from dual@enmo

*

ERROR at line 1:

ORA-24442: SCN exceeds the capability of the target OCI database or client

SQL> create database link enmo

connect to eygle identified by eygle using 'enmo';

Database link created.

SQL> select * from dual@enmo;

select * from dual@enmo

*

ERROR at line 1:

ORA-24442: SCN exceeds the capability of the target OCI database or client

这是一个新的错误号:

ORA-24442: SCN exceeds the capability of the target OCI database or client

Cause: An attempt was made to transfer a system change number (SCN) to an Oracle database or client that is older than Release 12.2 and the SCN exceeds the maximum value that such a system can handle.

Action: If needed, update the target database or client to Release 12.2 or higher.

ORA-24442: SCN exceeds the capability of the target OCI database or client

Cause: An attempt was made to transfer a system change number (SCN) to an Oracle database or client that is older than Release 12.2 and the SCN exceeds the maximum value that such a system can handle.

Action: If needed, update the target database or client to Release 12.2 or higher.

有了BigSCN的新特性,在12.2版本之后,Oracle 关于SCN的种种问题,可能再也不容易被遇到了。

IT基础架构

Oracle DB2 MySQL NoSQL

返回搜狐,查看更多



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有